import Vue from 'vue'
import Router from 'vue-router'
import Main from '@/components/Main'
import Book from '@/components/Book'
import Search from '@/components/Search'
import Tag from '@/components/Tag'
import Article from '@/components/Article'
import Articles from '@/components/Articles'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/index',
      name: 'Index',
      redirect: '/articles'
    },
    {
      path: '/',
      name: 'Main',
      component: Main
    },
    {
      path: '/novels',
      name: 'Search',
      component: Search
    },
    {
      path: '/read',
      name: 'read',
      component: () => import('@/components/Reader')
    },
    {
      path: '/reader',
      name: 'reader',
      redirect: '/reader/s',
      component: () => import('@/components/MainView'),
      children: [
        {
          path: 's',
          name: 'Reader Search',
          component: () => import('@/components/S')
        },
        {
          path: 'b',
          name: 'Reader Book',
          component: () => import('@/components/B')
        },
        {
          path: 'r',
          name: 'Reader Chapter',
          component: () => import('@/components/R')
        }
      ]
    },
    {
      path: '/novels/tag/:tag',
      name: 'Tag',
      component: Tag
    },
    {
      path: '/novels/:novelId',
      name: 'Book',
      component: Book
    },
    {
      path: '/articles',
      name: 'Articles',
      component: Articles
    }, {
      path: '/article/:id',
      name: 'Article',
      component: Article
    },
    {
      path: '/novels/:novelId/:chapterId',
      name: 'Chapter',
      component: () => import('@/components/Chapter')
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('@/components/Login')
    },
    {
      path: '/join',
      name: 'Join',
      component: () => import('@/components/Join')
    }
  ]
})
